package org.example;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-10-19
 * 16:27
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        String p=sc.nextLine();
        String ss=s+s;
        if(ss.contains(p)){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}
